#ifndef INET_BUFFER_H
#define INET_BUFFER_H

#include <semaphore.h>
#include <pthread.h>
#include <string>
#include <vector>

#include "SocketStream.h"

#define BUFFERSIZE 100

class Buffer
{
 public:
  struct entry 
  {
    std::string msg;
    SocketStream * peer;
  };
  
  Buffer();
  ~Buffer();
  
  entry get();
  void put(entry);
  
 private:
  std::vector<entry> buf_;
  sem_t full_, empty_;
  pthread_mutex_t mutex_;
};

#endif


